#ifndef CONTEXTVIEWER_H
#define CONTEXTVIEWER_H

#include <QtGui/QMainWindow>
#include <QtDeclarative/QDeclarativeView>
#include <QtGui/QApplication>
#include <QtGui/QDesktopWidget>
#include <QDebug>
#include "stdinreader.h"
#include <QDeclarativeContext>

class ContextViewer : public QDeclarativeView
{
    Q_OBJECT
    
signals:
    void focusOut();
//Q_INVOKABLE
public:
    ContextViewer(QWidget *parent = 0);
    //void afterLoad();

    void setReader(StdInReader *reader);
    void setWinFlags(QString sWinF);
    void setHideWhenUnfocus(bool hide);
    ~ContextViewer();


public slots:
    void fixePosition(QString sPos);
    void fixeSize(QString sSize);
    void fixePosAndSize(QString sPos,QString sSize);
    void loadFile(QString qmlFile);
    void reloadFile();
    void onShow();

protected:
    void hideEvent(QHideEvent *e);
    void showEvent ( QShowEvent * e);
    void focusOutEvent ( QFocusEvent * event );

private:
    StdInReader *m_reader;
    QString sSize,sPos, lastFileLoaded;
    QString sWflags;
    bool posFixed;
    bool sizeFixed;
    bool hideWhenUnfocus;
};

#endif // CONTEXTVIEWER_H
